﻿using System.Text;

namespace Isaac.Joy.StringHelper
{
	public sealed class StringId
	{
		public static string Create(int id, int length)
		{
			StringBuilder sid = new StringBuilder();
			int idlength = id.ToString().Length;
			if (idlength < length)
			{
				sid.Append(id.ToString());
			}
			else
			{
				sid.Append(id.ToString().Substring(0,length));
			}
			while (sid.Length < length)
			{
				sid.Insert(0, 0);
			}
			return sid.ToString();
		}
	}
}
